﻿#region Header
// ------------------------ Licence / Copyright ------------------------
// 
// ScrumTable for Scrum Meeting Support
// Copyright © HSR - Hochschule für Technik Rapperswil
// All Rights Reserved
// 
// Author:
//  Michael Gfeller Silvan Gehrig Patrick Boos
// 
// ---------------------------------------------------------------------
#endregion

#region Usings

using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using ScrumTable.Common;


#endregion

namespace ScrumTable.UI.ViewModel.Tools.Toast
{

    public enum ToastType {Error}


    public class ToastList : ObservableCollection<ToastItem>
    {
        public List<ToastItem> GetToastsByType(ToastType type)
        {
            return (from toast in this where toast.Type == type select toast).ToList();
        }
    }

    /// <summary>
    /// Description of the class
    /// </summary>
    public class ToastItem
    {

        #region Declarations
        //--------------------------------------------------------------------
        // Declarations
        //--------------------------------------------------------------------
        
        

        #endregion

        #region Properties
        //--------------------------------------------------------------------
        // Properties
        //--------------------------------------------------------------------

        /// <summary>
        /// Contains the Title Key for this Toast
        /// </summary>
        public string TitleKey { get; private set; }

        public ToastType Type { get; private set; }

        /// <summary>
        /// Contains the Object data for this object
        /// </summary>
        public object Content { get; set; }
        


        #endregion

        #region Constructors / Destructor
        //--------------------------------------------------------------------
        // Constructors / Destructor
        //--------------------------------------------------------------------

        public ToastItem(string titleKey, ToastType type, object content)
        {
            TitleKey = titleKey;
            Type = type;
            Content = content;
        }
   
        #endregion

        #region Methods
        //--------------------------------------------------------------------
        // Methods
        //--------------------------------------------------------------------

        public T GetContent<T>()
        {
            return Content.ChangeType<T>();
        }
     
        #endregion

        #region Events
        //--------------------------------------------------------------------
        // Events
        //--------------------------------------------------------------------

        #endregion

    }
}